/* Copyright(C) 2025. Huawei Technologies Co.,Ltd. All rights reserved.
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

// Package slownode a constants parameters for slownode
package slownode

import "time"

const (
	// CmConsumer who uses these configmap
	CmConsumer = "fd-ol-slow-node"
	// CmConsumerValue the value only for true
	CmConsumerValue = "true"
	// DLNamespace is the namespace of MindX DL
	DLNamespace = "mindx-dl"
	// SlowNodeFeaturePrefix is prefix of slow node feature config name
	SlowNodeFeaturePrefix = "ras-feature-slownode"
	// NodeSlowNodeJobPrefix is the job prefix of slow node job
	NodeSlowNodeJobPrefix = "slow-node-job"
	// NodeSlowNodeAlgoResultPrefix is prefix of slow node node algo result name
	NodeSlowNodeAlgoResultPrefix = "slow-node-algo-result"
	// NodeDataProfilingResultPrefix is the prefix of slow node node data parse result name
	NodeDataProfilingResultPrefix = "data-profiling-result"
	// SlowNodeFatureCMKey configmap key for slow node feature
	SlowNodeFatureCMKey = "FeatConf"
	// NodeSlowNodeJobCMKey is the configmap key for node slow node job
	NodeSlowNodeJobCMKey = "NodeSlowNodeJob"
	// NodeSlowNodeAlgoResultCMKey configmap key for slow node algo result
	NodeSlowNodeAlgoResultCMKey = "NodeSlowNodeAlgoResult"
	// NodeDataProfilingResultCMKey configmap key
	NodeDataProfilingResultCMKey = "NodeDataProfilingResult"
	// ClusterFilePath cluster local file path
	ClusterFilePath = "/user/slownode-cluster"
	// NodeFilePath node local file path
	NodeFilePath = "/user/cluster-info/profiling"
	// ParallelGroupInfo file name
	ParallelGroupInfo = "parallel_group.json"
	// MinStepCount is the count of csv file generated by the data parse
	MinStepCount = 20
)

// SlowNodeStep is the int type for process step
type SlowNodeStep int

const (
	// InitialStep is the first step for all job
	InitialStep SlowNodeStep = 0

	// ClusterStep1 is start all profiling
	ClusterStep1 SlowNodeStep = 1
	// ClusterStep2 is start slow node algo
	ClusterStep2 SlowNodeStep = 2

	// NodeStep1 is start data parse
	NodeStep1 SlowNodeStep = 1
	// NodeStep2 is report data profiling result
	NodeStep2 SlowNodeStep = 2
	// NodeStep3 is start slow node algo
	NodeStep3 SlowNodeStep = 3
)

const (
	// IsSlow is the metric name of diag item
	IsSlow = "isSlow"
	// DegradationDiag is the name of degradation diag
	DegradationDiag = "DegradationDiag"
	// IsDegradation is the sign of degradation
	IsDegradation = 1
)

const (
	redoInterval    = 10 * time.Minute
	recordsCapacity = 10
	channelCapacity = 5
)
